package com.lovo.stock.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.lovo.stock.bean.JournalBean;
import com.lovo.stock.bean.PageInfo;
import com.lovo.stock.constant.MessageCode;
import com.lovo.stock.service.IJournalService;
import com.lovo.stock.utils.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 日志控制器
 */
@RestController
@RequestMapping("/JournalController")
public class JournalController {

    @Autowired
    IJournalService journalService;
    /**
     * 分页查询日志列表
     * @param pageInfo
     * @return
     */
    @RequestMapping("/queryJournalByPage")
    public ResponseResult<IPage<JournalBean>> queryJournalByPage(@RequestBody PageInfo<JournalBean> pageInfo){
        ResponseResult<IPage<JournalBean>> responseResult=new ResponseResult<>();
        try {
            responseResult.setData(journalService.queryJournalByPage(pageInfo));
        }catch (Exception e){
            e.printStackTrace();
            responseResult.setMessage(MessageCode.ERROR.message);
            responseResult.setCode(MessageCode.ERROR.code);
        }
        return responseResult;
    }
}
